package com.sx.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import com.dfec.utils.DruidPlugin;
import com.dfec.utils.ToolDateTime;

public class ForcastService {
//	两种连接池切换
//	QueryRunner qr=new QueryRunner(DataSourceUtils.getDatasSource());
	QueryRunner qr=new QueryRunner(DruidPlugin.getDataSource());
	List<Object> list=null;
	
	public List<Object> getForcast(String city,String cnty) throws Exception{
		list=new ArrayList<>();
		String sql=" select * FROM cmiss_focast WHERE city='"+city+"' AND  cnty like'"+cnty+"%' "
				+  "  and day=(select MAX(day) from cmiss_focast where mon="+ToolDateTime.getCurrentMon()+") ORDER BY Validtime asc";
		List<Map<String, Object>> result = qr.query(sql, new MapListHandler());
		list.add(result);
		return list;
	}
	
	
	
}
